HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /var/www/kevin-demo/wp-content/plugins/post-smtp/Postman/Postman-Mail/Services/Smtp2Go/Handler.php
<?php
	/**
	 * PostmanSmtp2GoHandler
	 *
	 * @package Postman
	 */

	defined( 'ABSPATH' ) || exit;

	if ( ! class_exists( 'PostmanSmtp2GoHandler' ) ) {
		class PostmanSmtp2GoHandler extends PostmanServiceRequest {
			private $email_sent_code = 200;
			private $api_key = '';
			private $base_url = 'https://api.smtp2go.com/v3/email';

		public function __construct( $api_key ) {
			$this->api_key = $api_key;

			parent::__construct( $this->base_url );
			
			// Set 30-second timeout for SMTP2GO requests
			$this->set_additional_args( array( 'timeout' => 30 ) );
		}			
		
		private function get_headers() {
				return array(
					'Content-Type'  =>  'application/json',
					'X-Smtp2go-Api-Key' => $this->api_key,
					'accept' => 'application/json',
				);
			}

			public function send( $content ) {
				$content = json_encode( $content );

				return $this->request(
					'POST',
					'/send',
					$this->get_headers(),
					$content,
					$this->email_sent_code
				);
			}
		}
	}